package com.project.service.imp;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.project.bean.CategoryBean;
import com.project.bean.NewBean;
import com.project.mapper.ICategoryMapper;
import com.project.mapper.INewMapper;
import com.project.service.ICategoryService;
import com.project.service.INewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class CategoryServiceImp implements ICategoryService {
    @Autowired
    private ICategoryMapper mapper;


    @Override
    public void add(CategoryBean categoryBean) {
        mapper.insert(categoryBean);
    }

    @Override
    public void del(Integer id) {
        mapper.deleteById(id);
    }

    @Override
    public void upd(Integer id, String name) {
        CategoryBean categoryBean = mapper.selectById(id);
        categoryBean.setName(name);
        mapper.updateById(categoryBean);
    }
}
